﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NTQOnlineExam.Services.DBCommand;
using NTQOnlineExam.Services.Infrastructure.Utility;

namespace NTQOnlineExam.Services.CommandService.Examination
{
    public class ExaminationCommandService : IExaminationCommandService
    {
        public bool CreateExamination(AddExaminationCommand addExaminationCommand, out int examinationId)
        {
            Guard.ArgumentIsNotNull(addExaminationCommand, "command");
            Guard.Against<ArgumentException>(addExaminationCommand.TermId <= 0, "Term Id is required");
            Guard.Against<ArgumentException>(addExaminationCommand.UserId <= 0, "User Id is required");            
            var result = DBCommand.DBCommand.CreateInstant().CreateExaminationDbCommand(addExaminationCommand, out examinationId);
            return result;
        }
    }
}
